package com.ternnetwork.batch.writer;

import javax.annotation.Resource;
import javax.persistence.EntityManagerFactory;

import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.database.JpaItemWriter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.ternnetwork.batch.model.TestUser;





/**
 * jpa数据库写入器配置
 * @author xuwenfeng
 *
 */
@Configuration
public class TestUserJpaItemWriterConfiguration  {
	

	 @Resource
     private EntityManagerFactory entityManager; 
	
	
	 @Bean("testUserJpaItemWriter")
	 public ItemWriter<TestUser> getJpaItemWriter() {
	        JpaItemWriter<TestUser> writer = new JpaItemWriter<TestUser>();
	        writer.setEntityManagerFactory(entityManager);
	        return writer;
	 }
	 
	 
	 
	 
	 

}
